package org.outlook.crawler.client.domain;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import org.outlook.crawler.client.pojo.ErrorType;

public class ErrorReport implements Serializable{

	private static final long serialVersionUID = 1L;

	public static long SECOND_MILL = 1000L;

    private long id;
    private String keyword;
    private Resource source;
    private ErrorType errorType;
    private Date reportTime;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public Resource getSource() {
        return source;
    }

    public void setSource(Resource source) {
        this.source = source;
    }

    public ErrorType getErrorType() {
        return errorType;
    }

    public void setErrorType(ErrorType errorType) {
        this.errorType = errorType;
    }

    public Date getReportTime() {
        return reportTime;
    }

    public void setReportTime(Date reportTime) {
        this.reportTime = reportTime;
    }

    public boolean isExpired(long seconds) {
        return seconds == 0 || (Calendar.getInstance().getTime().getTime() - reportTime.getTime()) > (seconds * SECOND_MILL);
    }
}
